The present application relates generally to an improved data processing apparatus and method and more specifically to an apparatus and method for automatically closing a file or a device in a data processing system.
A device driver is a computer program allowing higher-level computer programs within a computer operating system to interact with a hardware device. A device driver typically communicates with the device through the computer bus or communications subsystem to which the hardware is connected. When a calling program invokes a routine in the device driver, the device driver issues commands to the device. Once the device sends data back to the device driver, the device driver may invoke routines in the original calling program.
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished.
Known computing operating systems usually track device and/or file opens that are performed by normal application programs and will ensure that the devices and files are closed when the application program exits. But this tracking by the operating systems does not completely protect against a device or file being left in an unwanted open/started state.
Some computer operating systems provide a mechanism for device drivers to open other device drivers. These are not normal application opens and are not tracked in the same way. The opens may need to persist beyond the exit of the application program that provoked the open. Also, known computer operating systems provide mechanisms to interact with devices beyond simple open( )/close( ). A device driver might provide a control entry point that allows a device to be readied for use, and a control exit point that allows the device to be quiesced after use. The computer operating system will provide a mechanism for calling the control entry points, but the operating system doesn't have any inherent knowledge of the fact that “QUIESCE” requests should be matched to “READY” requests like closes are matched to opens.
Because some opens, closes, and control requests are not tracked, difficulty occurs in determining why a device or file is being held in an opened or readied state when the device or file needs to be removed. A defect in an opener or readier could cause a device or file to become stuck in an open or ready state until the system is terminated.